﻿using System;
using System.Collections.Generic;

namespace Devv.FreshTracker.Entity
{
	[Serializable]
	public class SessionCollection : List<Session>
	{
		#region Helpers

		public Session Find(Int32 id)
		{
			foreach (Session s in this)
			{
				if (s.Id == id)
				{
					return s;
				}
			}

			return null;
		}

		public Session Find(Task task)
		{
			foreach (Session s in this)
			{
				if (s.Task.Id == task.Id && s.Task.Project.Id == task.Project.Id)
				{
					return s;
				}
			}

			return null;
		}

		#endregion
	}
}